package auth

import (
	kitjwt "github.com/go-kit/kit/auth/jwt"
	"github.com/go-kit/kit/endpoint"
)

func AuthMiddldware() endpoint.Middleware {
	return func(e endpoint.Endpoint) endpoint.Endpoint {
		kitjwt.NewParser(KeyFunc, JWTMethod, AuthClaimsFactory)
		kitjwt.NewSigner(JWTKin, JWTKey, JWTMethod, AuthClaims{})(e)
		kitjwt.GRPCToContext()
		return e
	}
}
